package com.camemax.server.controller;

import com.camemax.server.pojo.Orders;
import com.camemax.server.service.OrdersCreateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.TimeUnit;

// *********************
// ** @Date: 2021-06-22
// ** @Author: Camemax
// ** @Description: 订单服务 - 解析含有订单信息的请求，创建响应的订单
// *********************
@RestController
public class OrdersServerController {

    @Autowired
    OrdersCreateService createService;


    @GetMapping("/createOrder/{orderId}/{userId}/{orderContent}")
    public String createOrder(@PathVariable("orderId")String orderId,
                              @PathVariable("userId")String userId,
                              @PathVariable("orderContent")String orderContent){
        Orders orderInfo = new Orders();
        orderInfo.setOrderId(orderId);
        orderInfo.setUserId(userId);
        orderInfo.setOrderContent(orderContent);
        // 创建订单
        createService.createOrder(orderInfo);
        return "success！";
    }
}
